package com.team.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.team.util.UserFilterIdCardUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Reservation {
    private Integer id;
    private Integer userId;
    private Integer dutyId;
    private String idcard;
    private String name;
    private String sex;
    private String tel;
    private Integer sid;
    private String pnum;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date visitTime;
    private String ispayment;
    private String isdelete;
    private String isvisit;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime;
    private Duty duty;
    private Integer age;

    private String birthday;

    public Integer getAge() {
        return UserFilterIdCardUtil.getAgeByIdCard(idcard);
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getBirthday() {
        return UserFilterIdCardUtil.getBirthdayByIdCard(idcard);
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}